package czk.concrent.threadstatus;

/**
 * @Author:ChenZhangKun
 * @Date: 2020/4/30 22:11
 */
public class JoinTest {
    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(1);
                try {
                    Thread.sleep(1*1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(2);
            }
        },"t1");
        thread.start();
        // 阻塞、会等待线程运行结束再执行
        thread.join();
        System.out.println(3);
    }
}
